import request from './request'
import type {
  listResponse,
  CommentResponse
} from './type'
// 歌单接口
export const playlistApi = (id: number) => {
  return request<listResponse>({
    url: '/playlist/detail',
    data: {
      id
    }
  })
}
// 歌单界面评论接口
export const commentApi = (id: number) => {
  return request<CommentResponse>({
    url: '/comment/playlist',
    data: {
      id
    }
  })
}
import type {
  rankingGet,//排行榜
  recommendGet//每日推荐
} from './type'

//排行榜
export const rankingGetApi = () => {
  return request<rankingGet>({ url: '/toplist/detail' })
}
//每日推荐
export const recommendApi = () => {
  return request<recommendGet>({ url: '/recommend/songs' })
}

// 搜索引入类型
import type {
    HotSearchResponse,
    SuggestionResponse,
    SearchResponse,
    Player,
    lyric
} from "./type";


// 热搜接口
export const searchHotApi = () => {
    return request<HotSearchResponse>({url: '/search/hot/detail'})
}

// 搜索建议接口
export const searchAdviceApi = (keywords: string) => {
    return request<SuggestionResponse>({
        url: '/search/suggest',
        data: {
            keywords,
            type:'mobile'
        }
    })
}

// 搜索结果接口
export const searchResultApi = (keywords: string) => {
    return request<SearchResponse>({
        url: '/search',
        data: {
            keywords,
        }
    })
}

// 播放接口
export const playerMusicApi = (id :number) => {
  return request<Player>({
    url: '/song/url',
    data: {
      id
    }
  })
}
// 歌词接口
export const playerLyricApi = (id :number) => {
  return request<lyric>({
    url: '/lyric',
    data: {
      id
    }
  })
}
// 单个歌曲聊天
export const MusicCommentApi = (id: number) => {
  return request<CommentResponse>({
    url: '/comment/music',
    data: {
      id
    }
  })
}
// 主页引入类型
import type { ResDataType, LoginStateType, UserDetailType } from './type'
//主页banners
export const indexApi = () => {
  return request<ResDataType>({url: '/homepage/block/page'})
}

// 获取 二维码 key 接口
import type { loginType } from './type'
export const loginKeyApi = () => {
  return request<loginType>({url: `/login/qr/key?a=${Date.now()}`})
}

// 获取 二维码 图片 接口
import type { loginImg } from './type'
export const loginImgApi = (key:string) => {
  return request<loginImg>({url: `/login/qr/create?key=${key}&qrimg=qrimg&a=${Date.now()}`})
}

// 获取 二维码 返回状态 接口
import type { QRcode } from './type'
export const QRcodeApi = (key:string) =>{
  return request<QRcode>({url: `/login/qr/check?key=${key}&a=${Date.now()}`})
}

// 用户登陆状态
export const LoginStateApi = () => {
  return request<LoginStateType>({url: '/login/status'})
}
// 退出登录
export const LogoutApi = () => {
  return request({url: '/logout'})
}
// 获取用户详情
export const UserDetailApi = (id: number) => {
  return request<UserDetailType>({url: `/user/detail?uid=${id}`})
}

// 用户歌单信息
export const UserSongListApi = (uid: number) => {
  return request({url: `/user/playlist?uid=${uid}`})
}
